package com.nbsaas.boot.shopping.utils;

import com.nbsaas.boot.order.api.domain.request.OrderRequest;

import java.time.LocalDate;
import java.time.temporal.IsoFields;
import java.time.temporal.WeekFields;
import java.util.Locale;

public class OrderUtils {

    public static void  configDate(OrderRequest request){
        LocalDate today = LocalDate.now();
        request.setYear(today.getYear());
        int quarter = today.get(IsoFields.QUARTER_OF_YEAR);
        request.setQuarter(quarter);
        request.setMonth(today.getMonthValue());
        WeekFields weekFields = WeekFields.of(Locale.getDefault());
        int weekNumber = today.get(weekFields.weekOfWeekBasedYear());
        request.setWeek(weekNumber);
        request.setDay(today.getDayOfYear());
        request.setDayOfMonth(today.getDayOfMonth());
        request.setDayOfWeek(today.getDayOfWeek().getValue());

    }

}
